package mylab.starters.mybatis.interceptor.impl;

import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import mylab.starters.mybatis.interceptor.OrderlyInterceptor;
import mylab.starters.mybatis.config.DbProperties;

public class MyPaginationInnerInterceptor extends PaginationInnerInterceptor implements OrderlyInterceptor {

    public MyPaginationInnerInterceptor(DbProperties properties) {
        //数据库类型
        setDbType(properties.getDbType());
        //溢出总页数后是否进行处理
        setOverflow(properties.isOverflow());
        //单页分页条数限制
        setMaxLimit(properties.getPageMaxLimit());
    }

    @Override
    public int getOrder() {
        return OrderlyInterceptor.Pagination;
    }

    @Override
    public String getDescription() {
        return "分页插件";
    }
}
